package xin.marcher.module.label.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xin.marcher.module.label.domain.dto.LabelGroupDTO;
import xin.marcher.module.label.domain.dto.LabelGroupResultDTO;
import xin.marcher.module.label.domain.request.LabelGroupRequest;
import xin.marcher.module.label.domain.request.QueryLabelGroupRequest;
import xin.marcher.module.label.repository.LabelRepository;
import xin.marcher.module.label.service.LabelGroupService;

import java.util.List;

/**
 *
 */
@Service
public class LabelGroupServiceImpl implements LabelGroupService {

    @Autowired
    private LabelRepository labelRepository;

    /**
     * @param request
     * @return
     */
    @Override
    public LabelGroupResultDTO saveLabelGroup(LabelGroupRequest request) {
        Long id = labelRepository.saveLabelGroup(request);
        return new LabelGroupResultDTO(id, true);
    }

    /**
     * @param request
     * @return
     */
    @Override
    public List<LabelGroupDTO> listLabelGroups(QueryLabelGroupRequest request) {
        return labelRepository.queryLabelGroupList(request);
    }
}
